﻿#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ESF.General;
using ESF.Web;

#endregion


public partial class _Default : ESF.Web.Pages.BasePage
{
	#region Propiedades

	public string MainPageURL
	{
		get
		{
			string mainPageURL;
			
			
			mainPageURL = Request.QueryString ["ESF.SSO.MainPageURL"];

			if (string.IsNullOrWhiteSpace (mainPageURL))
			{
				mainPageURL = ReadConfig.GetAppSetting ("ESF.SSO.MainPageURL", "ContactUs.aspx");
			}

			return mainPageURL;
		}
	}

	#endregion


    #region Page Events
	
	protected void Page_Load(object sender, EventArgs e)
    {
		if (!IsPostBack)
		{
			divMenuHeader.CssClass = "header_" + ReadConfig.ClientName;

			ifrMP_Contents.Attributes["onload"] = "HideLoadingMessage(); this.style.height = (IsIE ? this.contentWindow.document.body.scrollHeight : this.contentWindow.document.documentElement.offsetHeight) + 'px';";

			ifrMP_Contents.Attributes["src"] = MainPageURL;
			
						
			JS.AddEndJS(Page, @"FixSizeReportOnload = FixSizeContentsIframeOnload = function (pReallyHeight) 
			{
				try
				{
					var ifrMP_Contents = $('#" + ifrMP_Contents.ClientID + @"');

					var height = 600;
					var tempHeight;
					

					tempHeight = (IsIE ? ifrMP_Contents[0].contentWindow.document.body.scrollHeight : ifrMP_Contents[0].contentWindow.document.documentElement.offsetHeight);

					if (typeof (pReallyHeight) == ""undefined"" || isNaN (pReallyHeight))
					{
						pReallyHeight = 0;
					}
					
					if (tempHeight > pReallyHeight)
					{
						height = tempHeight;
					}
					else
					{
						height = pReallyHeight;
					}

					try 
					{ 
						tempHeight = ifrMP_Contents[0].GetSizeOverByID ();

						if (typeof (tempHeight) == ""undefined"" || isNaN (tempHeight))
						{
							tempHeight = 0;
						}

						if (height < tempHeight)
						{
							height = tempHeight
						}
					}
					catch (ex) {} 

					ifrMP_Contents.height(height);
				}
				catch (ex) {} 
			}");
		}
    }

	#endregion
}